package exey.utils 
{
	import flash.display.DisplayObject;
	import flash.display.Graphics;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	/**
	 * ...
	 * @author Exey Panteleev
	 */
	public class DrawUtils
	{
		/** Draw AdviceDog Motivator Background for Game Over window */
		static public function drawAdviceDogTemplate( g:Graphics, alpha:Number, x:int, y:int ):void 
		{
			with( g ){
				moveTo(142+x, 157+y);
				beginFill(0xFF00FF, alpha);
				lineTo(128+x, 0+y);
				lineTo(0+x, 0+y);
				lineTo(0+x, 113+y);
				lineTo(142+x, 157+y);
				beginFill(0xFF0000, alpha);
				lineTo(0+x, 276+y);
				lineTo(0+x, 113+y);
				lineTo(142+x, 157+y);
				beginFill(0xFF7F00, alpha);
				lineTo(153+x, 300+y);
				lineTo(0+x, 300+y);
				lineTo(0+x, 276+y);
				lineTo(142+x, 157+y);
				beginFill(0xFFFF00, alpha);
				lineTo(153+x, 300+y);
				lineTo(300+x, 300+y);
				lineTo(300+x, 196+y);
				lineTo(142+x, 157+y);
				beginFill(0x00FF00, alpha);
				lineTo(300+x, 196+y);
				lineTo(300+x, 26+y);
				lineTo(142+x, 157+y);
				beginFill(0x0000FF, alpha);
				lineTo(128+x, 0+y);
				lineTo(300+x, 0+y);
				lineTo(300+x, 26+y);
				lineTo(142+x, 157+y);
			}
		}
		
		static public function drawTransparentTextButton(sprite:Sprite, text:String, fontSize:Number, fontColor:uint = 0xFFFFFF, color:uint = 0xFF0000):void 
		{
			var g:Graphics = sprite.graphics;
			g.beginFill(color, .4);
			g.drawRoundRect( -fontSize*5.2, -fontSize*0.8, fontSize*10.4, fontSize*1.6, fontSize*0.5, fontSize*0.5);
			var tf:TextField = new TextField();
			var f:TextFormat = new TextFormat("Verdana", fontSize, fontColor, true);
			tf.defaultTextFormat = f;
			tf.text = text;
			tf.selectable = false;
			tf.mouseEnabled = false;
			tf.autoSize = TextFieldAutoSize.LEFT;
			tf.x = -tf.width*.5;
			tf.y = -fontSize*0.73;
			sprite.addChild(tf);
			sprite.buttonMode = true;
		}
	}
}